load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "allocator2",
    srcs = [
        "allocator.go",
        "allocator_state.go",
        "cluster_state.go",
        "constraint.go",
        "constraint_matcher.go",
        "load.go",
        "memo_helper.go",
        "messages.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/allocator/allocator2",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "allocator2_test",
    srcs = [
        "constraint_matcher_test.go",
        "constraint_test.go",
        "load_test.go",
        "memo_helper_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":allocator2"],
    deps = [
        "//pkg/roachpb",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//require",
    ],
)
